<?php

final class Apk_Db_Table_Rowset extends Zend_Db_Table_Rowset
{
    private $_decorator = null;

    protected $_pager;


    /**
     * Apk_Db_Table_Row_Abstract class name.
     *
     * @var string
     */
    protected $_rowClass = 'Apk_Db_Table_Row';

    public function __construct(array $config)
    {
        $this->_pager = @$config['pager'];
        parent::__construct($config);
    }

    public function getFieldArray($fild_name)
    {
        $result = array();
        foreach ($this->_data as $value) {
            $result[] = @$value[$fild_name];
        }
        return $result;
    }

    public function setPager(array $pager)
    {
        $this->_pager = $pager;
    }

    public function getPager()
    {
        return $this->_pager;
    }

    public function toArray()
    {
        $result = array();
        
        $pager = @$this->getPager();

        $result = parent::toArray();
        
        if (!empty($pager)){
            $result['pager'] = $pager;
        }
        
        return $result;
    }
}